package com.hx.service;

import com.hx.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class UserService1 {
    //注入UserDao
    @Autowired
    //当注入的bean有多个实现类对象时，要指定注入的bean对象的名称
    //否则报错：NoUniqueBeanDefinitionException
    @Qualifier(value = "userDaoImpl1")
    private UserDao userDao;

    //定义尘缘方法
    public void add(){
        System.out.println("添加成功！！");
        //调用持久层方法
        userDao.save();
    }
}
